
#include <avr/io.h>
#include <avr/delay.h>

#include "ParaJoy.h"



void delayms(uint16_t millis) {
  while ( millis ) {
    _delay_ms(1);
    millis--;
  }
}

static void vAjeskTask0(void *para UNUSED)
{

  while (1) {
  	PORTB &= ~(1<<PB0); /* LED on */
	delayms(900);
	PORTB |= 1<<PB0; /* LED off */
	delayms(2000);
	//blink();

  }
}

static void vAjeskTask1(void *para UNUSED)
{
  while (1) {
		PORTB &= ~(1<<PB1); /* LED on */
		delayms(2000);
		PORTB |= 1<<PB1; /* LED off */
		delayms(900);

  }
}

static void vAjeskTask2(void *para UNUSED)
{
  while (1) {
		PORTB &= ~(1<<PB2); /* LED on */
		delayms(2000);
		PORTB |= 1<<PB2; /* LED off */
		delayms(900);

  }
}

static void vAjeskTask3(void *para UNUSED)
{
  while (1) {
		PORTB &= ~(1<<PB3); /* LED on */
		delayms(2000);
		PORTB |= 1<<PB3; /* LED off */
		delayms(900);

  }
}

int main(void) {
  DDRB |= 1<<PB0; /* set PB0 to output */
  DDRB |= 1<<PB1; /* set PB1 to output */

  DDRB |= 1<<PB2; /* set PB2 to output */
  DDRB |= 1<<PB3; /* set PB3 to output */

  jCreateTask(vAjeskTask0,0);
  jCreateTask(vAjeskTask1,1);
  jCreateTask(vAjeskTask2,2);
  jCreateTask(vAjeskTask3,3);

  StartScheduling();

  while(1) {

  }
  return 0;
}
